package de.zainodis.kitchengnome.domainmodel;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import de.zainodis.kitchengnome.domainmodel.persistence.ISuggestionDao.SuggestionDao;

@DatabaseTable(tableName = Suggestion.TYPE_NAME, daoClass = SuggestionDao.class)
public class Suggestion implements Comparable<Suggestion> {

	protected static final String TYPE_NAME = "Suggestion";

	@DatabaseField(id = true)
	private String name;

	protected Suggestion() {
		// For ormlite
	}

	public Suggestion(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	@Override
	public boolean equals(Object o) {
		if (o != null && o instanceof Suggestion) {
			String othersName = ((Suggestion) o).getName();
			return othersName != null ? othersName.equals(name) : false;
		}

		return false;
	}

	@Override
	public int compareTo(Suggestion another) {
		return name.compareTo(another.name);
	}
}
